package com.design.patterns.list.builder.up;

/**
 * 建造者模式中的指挥者：封装产品建造者对产品的构建流程
 * @author Wangzhiwen
 */
public class HouseDirector {

    // 产品建造者
    private HouseBuilder houseBuilder;

    public HouseDirector() {
    }

    // 传入方式
    public HouseDirector(HouseBuilder houseBuilder) {
        this.houseBuilder = houseBuilder;
    }
    public void setHouseBuilder(HouseBuilder houseBuilder) {
        this.houseBuilder = houseBuilder;
    }

    // 产品的具体构建流程，交给指挥者
    public House constructorHouse(){
        houseBuilder.buildBasic();
        houseBuilder.buildWalls();
        houseBuilder.roofed();
        return houseBuilder.buildHouse();
    }
}
